﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DXApplicationTangche.UC.登录;
using DXApplicationTangche.UC.下单MTO.Service;

namespace DXApplicationTangche.UC
{
    public partial class Form重置密码 : DevExpress.XtraEditors.XtraForm
    {
        public Form重置密码()
        {
            InitializeComponent();
        }

        private void simpleButton确定_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(this.textBox用户名.Text) || String.IsNullOrWhiteSpace(this.textBox密码.Text))
            {
                MessageBox.Show("用户名密码不能为空");
                return;
            }
            try
            {
                PlainMessageResult result = 登录Service.updateSystemUserPassword(this.textBox用户名.Text.Trim(),this.textBox密码.Text.Trim());
                if (ConstPlainMessageResult.OK.Equals(result.errorCode))
                {
                    MessageBox.Show("修改密码成功");
                    this.Close();
                }
                else{
                    MessageBox.Show("修改密码失败");
                    return;
                }
            }
            catch
            {
                MessageBox.Show("修改密码失败");
                this.Close();
            }
        }
    }
}